		<p></p>
		<ul>
			<li><a href="index.php">Show Times</a></li>
			<li><a href="driver_view.php">Show Drivers</a>
			</li><li></li>
			<li><a href="driver_add.php">Add Driver</a></li>
			<p>	</p>
			<li><a href="drivertime_add.php">Add Driver Time</a></li>
			<li><a href="driver_edit.php">Edit Driver</a></li>
			<li><a href="finanse.php">Wallet</a></li>
		</ul>	
		<p></p>
		
<table id="table-2" class="tablesorter">
	<thead>
	<tr>
	<img src="images/clock.png" height="48"  /> TOP 3 Best Times:
	</tr>
	<tr>
		<th>Driver</th>
		<th>Time</th>
		</tR>
	</thead>
	<tbody>
		<?php
			$result = mysql_query("SELECT time_lap, driver.description AS driver
FROM times, driver
WHERE times.driver_id = driver.id 
ORDER BY time_lap ASC
LIMIT 3"); 
			if (!$result) {
				die('Invalid query: ' . mysql_error());
			}
			while($row = mysql_fetch_array($result))
			  {
				echo "<TR>";
				echo "<TD> " . $row['driver']  . " </TD>";  
				echo "<TD> " . $row['time_lap']  . " </TD>";  
			  }
			  echo "</TR>"	;
		?> 
	</tbody>
</table>
<p></p>
		
<table id="table-2" class="tablesorter">
	<thead>
	<tr>
	<img src="images/clock.png" height="48"  /> TOP 3 Worst Times:
	</tr>
	<tr>
		<th>Driver</th>
		<th>Time</th>
		</tR>
	</thead>
	<tbody>
		<?php
			$result = mysql_query("SELECT time_lap, driver.description AS driver
FROM times, driver
WHERE times.driver_id = driver.id 
ORDER BY time_lap DESC
LIMIT 3"); 
			if (!$result) {
				die('Invalid query: ' . mysql_error());
			}
			while($row = mysql_fetch_array($result))
			  {
				echo "<TR>";
				echo "<TD> " . $row['driver']  . " </TD>";  
				echo "<TD> " . $row['time_lap']  . " </TD>";  
			  }
			  echo "</TR>"	;
		?> 
	</tbody>
</table>

<p></p>
<table id="table-2" class="tablesorter">
	<thead>
	<tr>
	<img src="images/speed_kmh.png" height="48"  /> TOP 3 Horsepower:
	</tr>
	<tr>
		<th>Driver</th>
		<th>Horsepower</th>
		</tR>
	</thead>
	<tbody>
		<?php
			$result = mysql_query("SELECT description, horsepower FROM  driver ORDER by horsepower DESC LIMIT 3"); 
			if (!$result) {
				die('Invalid query: ' . mysql_error());
			}
			while($row = mysql_fetch_array($result))
			  {
				echo "<TR>";
				echo "<TD> " . $row['description']  . " </TD>";  
				echo "<TD> " . $row['horsepower']  . " Hp </TD>";  
			  }
			  echo "</TR>"	;
		?> 
	</tbody>
</table>

<p></p>
<table id="table-2" class="tablesorter">
	<thead>
	<tr>
	<img src="images/fuel.png" height="48"  /> Fuel Types:
	</tr>
	<tr>
		<th> Type</th>
		<th> Total </th>
		</tR>
	</thead>
	<tbody>
	<TR>
	<TR>
		<TD>
		PB
		</TD>
		<TD>
		<?
		$totalpb = mysql_query("SELECT count(id) FROM driver WHERE fuel='pb';");
		$row = mysql_fetch_row($totalpb);
		//echo "" . $row['count(id)']  . " ";
		print_r($row[0]);
		?>
		</TD>
		</TR><TR>
		<TD>ON:</TD>
		<TD>
		<?
		$totalpb = mysql_query("SELECT count(id) FROM driver WHERE fuel='on';");
		$row = mysql_fetch_row($totalpb);
		//echo "" . $row['count(id)']  . " ";
		print_r($row[0]);
		?></TD>
		</TR>
	</tbody>
</table>

<p></p>
<p></p>
		<table id="table-2" class="tablesorter">
			<thead>
	<tr>
	<img src="images/helmet.png" height="48"  /> Drivers
	</tr>
	<tr>
		<th colspan="2"> .</th>

		</tR>
	</thead>
			<tbody>
			<TR>
				<TD>
					 Total Drivers: 
				</TD>
				<TD align="right">
					<?php 
					$total = mysql_query('SELECT count(id) from driver;');
					$row = mysql_fetch_row($total);
					print_r($row[0]);
					?>
				</TD>
			</TR>
		</TBODY>
	</TABLE>

<p></p>
		<table  id="table-2" width="100%">
			<thead>
				<th colspan="2">TODO LIST:</th>
				<th> </th>
			</thead>
			<tbody>
			<TR>
				<TD colspan="2">
					- zrobić sortowanie w czasie rzeczywistym <BR/>
					- dopracować kodowanie polskich znaków  
				</TD>
				
			</TR>
		</TBODY>
	</TABLE>
